package com.shenma2009.demo;

import java.util.ArrayList;

/**
 * @author 军哥
 * @version 1.0
 * @description: OomDemo
 * @date 2023/6/27 8:39
 */

public class OomDemo {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        int i = 0;
        while(true) {
            list.add(""+i);
            Integer step = i;
            step ++;
            i = step;

            OomDemo oomDemo = new OomDemo();
            String userById = oomDemo.getUserById(i % 100);
            userById += ",";

            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public String getUserById(Integer userId) {
        if(userId < 25) {
            return "young";
        }
        else if(userId>=25 && userId<35) {
            return "middle";
        }
        else {
            return "old";
        }
    }
}
